package com.lyh.yobeiapplication.activity;

import android.app.Activity;
import android.os.Bundle;

import com.lyh.yobeiapplication.helper.ApplicationManager;

/**
 * 应用程序Activity的基类
 */
public class BaseActivity extends Activity {

//    private int[] recycleId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 添加Activity到堆栈
        ApplicationManager.getAppManager().addActivity(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
//        if (recycleId != null) {
//            View view = null;
//            try {
//                for (int i = 0; i < recycleId.length; i++) {
//                    view = findViewById(recycleId[i]);
//                    if (view != null) {
//                        view.setBackgroundResource(0);
//                        view.destroyDrawingCache();
//                    }
//                }
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//            System.gc();
//        }
        // 结束Activity&从堆栈中移除
        ApplicationManager.getAppManager().finishActivity(this);
    }

//    public void recycleViewBGId(int... ids) {
//        recycleId = ids;
//    }
}
